<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

class CreatePermissionsTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('permissions', function (Blueprint $table) {
            $table->comment('权限表');
            $table->bigIncrements('id');
	        $table->unsignedBigInteger('pid')->default(0)->comment('父级ID');
	        $table->string('authority')->unique()->comment('权限唯一标识');
	        $table->string('type')->default(0)->comment('类型：0目录，1菜单，2按钮，3接口');
	        $table->string('name')->comment('名称');
	        $table->string('request_method')->nullable()->comment('请求方式');
	        $table->string('request_uri')->nullable()->comment('请求路径');
            $table->string('menu_icon')->nullable()->comment('菜单icon（is_menu=1时有效）');
            $table->integer('sort')->default(0)->comment('排序号');
            $table->dateTime('deleted_at')->nullable()->comment('删除标记');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('permissions');
    }
}
